import { formatTimestamp } from '@/settings'

const defaultSettings = require('@/settings.js')

export default (_self) => {
  return {
    editBtn: true,
    delBtn: true,
    addBtn: false,
    menu: false,
    labelWidth: 140,
    index: true,
    indexLabel: '序号',
    searchShow: false,
    searchShowBtn: false,
    align: 'center',
    headerAlign: 'center',
    border: true,
    dialogWidth: '50%',
    stripe: false,
    size: 'mini',
    // excelBtn: true,
    // selection: true,
    searchMenuSpan: 4,
    props: {
      label: 'label',
      value: 'value'
    },
    column: [
      {
        prop: 'userinfo',
        label: '用户信息',
        children: [

          {
            prop: 'avatarUrl',
            type: 'img',
            label: '头像'
          },
          {
            prop: 'nickName',
            label: '昵称'
          },
          {
            prop: 'mobile',
            label: '手机号'
          },
          {
            prop: 'gender',
            label: '性别',
            type: 'select',
            dicData: [
              {
                value: 1,
                label: '男'
              },
              {
                value: 0,
                label: '女'
              }
            ]
          },
          {
            prop: 'age',
            hide: true,
            label: '年龄'
          },
          {
            hide: true,
            prop: 'guardian',
            label: '监护人'
          }
        ]
      },
      {
        prop: 'totalNum',
        label: '总次数'
      },
      {
        prop: 'remainNum',
        label: '剩余次数'
      },
      {
        prop: 'owner',
        label: '持卡人',
        hide: true,
        rules: [
          {
            required: true,
            message: '请输入',
            trigger: 'blur'
          }
        ]
      },
      /*  {
        prop: 'cardNo',
        label: '卡号'
      },*/
      {
        prop: 'effectDays',
        label: '有效天数'
      },
      {
        label: '状态',
        prop: 'status',
        search: true,
        display: false,
        type: 'select',
        dicData: [
          {
            value: 0,
            label: '不可用'
          },
          {
            value: 1,
            label: '可用'
          },
          {
            value: 2,
            label: '已使用'
          }
        ],
        rules: [
          {
            required: true,
            message: '请输入',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '添加时间',
        prop: 'createTime',
        searchRange: true,
        type: 'datetime',
        addDisplay: false,
        editDisplay: false,
        formatter: (row, val) => {
          return formatTimestamp(val)
        },
        display: false,
        rules: [
          {
            required: true,
            message: '请输入',
            trigger: 'blur'
          }
        ]
      }
    ]
  }
}
